const { addrFormatError } = require("../constant/error.type")
/**地址模块参数校验 */
const addrValidator = (rules) => {
  return async (ctx, next) => {
    try {
      ctx.verifyParams(rules)
    } catch (error) {
      addrFormatError.result = error
      return ctx.app.emit('error', addrFormatError.message, ctx)
    }
    await next()
  }
}
module.exports = {
  addrValidator
}